package com.acme.bankapp.service.bank;


import com.acme.bankapp.domain.bank.Bank;
import com.acme.bankapp.domain.bank.CheckingAccount;
import com.acme.bankapp.domain.bank.Client;
import com.acme.bankapp.domain.bank.Gender;
import com.acme.bankapp.domain.bank.SavingAccount;
import com.acme.bankapp.domain.bank.Bank.DebugListener;
import com.acme.bankapp.domain.bank.Bank.EmailNotificationListener;
import com.acme.bankapp.domain.bank.Bank.PrintClientListener;

public class BankApplication {

	public static void main(String[] args) {
		ClientRegistrationListener[] listeners = clientRegistrationListenersCreator();
		Client[] clients = createTestClientArray();
		
		Bank bank = new Bank(clients, listeners);

		BankService.printBalance(bank);
				
		BankService.printMaximumAmountToWithdraw(bank);
		
		BankService.modifyBank(bank);
		
		BankService.printBalance(bank);
		
		BankService.printMaximumAmountToWithdraw(bank);
		
	}

	private static ClientRegistrationListener[] clientRegistrationListenersCreator() {
		return new ClientRegistrationListener[]{new DebugListener(), new EmailNotificationListener(), new PrintClientListener()};
	}

	/**
	 * creating simplest array of clients
	 * */
	private static Client[] createTestClientArray() {
		return new Client[]{
			new Client("Peter", Gender.MALE, new CheckingAccount(100, 50)),
			new Client("Ann", Gender.FEMALE, new SavingAccount(500))
		};
	}

	
}
